import numpy as np
import trimesh

# attach to logger so trimesh messages will be printed to console
trimesh.util.attach_to_log()

def load_faces():

    mesh = trimesh.load('.\mpu6050\car.obj')


    # 确保模型是三角面
    mesh.merge_vertices()
    #mesh.apply_transform(mesh.visual.to_unit_cube())

    # 列出所有面的顶点
    faces_vertices = []
    for face in mesh.faces:
        vers = mesh.vertices[face]
        # print(vers)
        faces_vertices.append([np.array(v) for v in vers])


    return faces_vertices  

# preview mesh in an opengl window if you installed pyglet and scipy with pip
# mesh.show()